<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../../">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>pyokx.data_structures &mdash; AntBot 0.0.1 documentation</title>
      <link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=80d5e7a1" />
      <link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" />
      <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css?v=eafc0fe6" />

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script src="../../_static/jquery.js?v=5d32c60e"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
        <script src="../../_static/documentation_options.js?v=d45e8c67"></script>
        <script src="../../_static/doctools.js?v=888ff710"></script>
        <script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../../_static/js/theme.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="../../index.html" class="icon icon-home">
            AntBot
          </a>
              <div class="version">
                0.0.1
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../autodocumentation_python.html">autodocumentation_python</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../firebase_tools.BaseClasses.html">firebase_tools.BaseClasses</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../firebase_tools.FirestoreClient.html">firebase_tools.FirestoreClient</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../firebase_tools.authenticate.html">firebase_tools.authenticate</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../h2o_dashboard.dashboard.html">h2o_dashboard.dashboard</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../h2o_dashboard.pages.documentation_page.html">h2o_dashboard.pages.documentation_page</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../h2o_dashboard.pages.okx_dashbaord_page.okx_antbot_okx_premium_indicator_handler.html">h2o_dashboard.pages.okx_dashbaord_page.okx_antbot_okx_premium_indicator_handler</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../h2o_dashboard.pages.okx_dashbaord_page.okx_dashboard_page.html">h2o_dashboard.pages.okx_dashbaord_page.okx_dashboard_page</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../h2o_dashboard.pages.okx_streams.html">h2o_dashboard.pages.okx_streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../h2o_dashboard.pages.overview_page.html">h2o_dashboard.pages.overview_page</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../h2o_dashboard.util.html">h2o_dashboard.util</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../h2o_dashboard.wave_auth.html">h2o_dashboard.wave_auth</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.Futures_Exchange_Client.html">pyokx.Futures_Exchange_Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.InstrumentSearcher.html">pyokx.InstrumentSearcher</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.data_structures.html">pyokx.data_structures</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.Account.html">pyokx.low_rest_api.Account</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.BlockTrading.html">pyokx.low_rest_api.BlockTrading</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.Convert.html">pyokx.low_rest_api.Convert</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.CopyTrading.html">pyokx.low_rest_api.CopyTrading</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.Earning.html">pyokx.low_rest_api.Earning</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.FDBroker.html">pyokx.low_rest_api.FDBroker</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.Funding.html">pyokx.low_rest_api.Funding</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.Grid.html">pyokx.low_rest_api.Grid</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.MarketData.html">pyokx.low_rest_api.MarketData</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.NDBroker.html">pyokx.low_rest_api.NDBroker</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.PublicData.html">pyokx.low_rest_api.PublicData</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.SpreadTrading.html">pyokx.low_rest_api.SpreadTrading</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.Status.html">pyokx.low_rest_api.Status</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.SubAccount.html">pyokx.low_rest_api.SubAccount</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.Trade.html">pyokx.low_rest_api.Trade</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.TradingData.html">pyokx.low_rest_api.TradingData</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.client.html">pyokx.low_rest_api.client</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.consts.html">pyokx.low_rest_api.consts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.exceptions.html">pyokx.low_rest_api.exceptions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.low_rest_api.utils.html">pyokx.low_rest_api.utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.market_data_service.WssMarketDataService.html">pyokx.okx_market_maker.market_data_service.WssMarketDataService</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.market_data_service.model.Instrument.html">pyokx.okx_market_maker.market_data_service.model.Instrument</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.market_data_service.model.MarkPx.html">pyokx.okx_market_maker.market_data_service.model.MarkPx</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.market_data_service.model.OrderBook.html">pyokx.okx_market_maker.market_data_service.model.OrderBook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.market_data_service.model.Tickers.html">pyokx.okx_market_maker.market_data_service.model.Tickers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.order_management_service.WssOrderManagementService.html">pyokx.okx_market_maker.order_management_service.WssOrderManagementService</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.order_management_service.model.Order.html">pyokx.okx_market_maker.order_management_service.model.Order</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.order_management_service.model.OrderRequest.html">pyokx.okx_market_maker.order_management_service.model.OrderRequest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.position_management_service.WssPositionManagementService.html">pyokx.okx_market_maker.position_management_service.WssPositionManagementService</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.position_management_service.model.Account.html">pyokx.okx_market_maker.position_management_service.model.Account</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.position_management_service.model.BalanceAndPosition.html">pyokx.okx_market_maker.position_management_service.model.BalanceAndPosition</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.position_management_service.model.Positions.html">pyokx.okx_market_maker.position_management_service.model.Positions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.run_sample_market_maker.html">pyokx.okx_market_maker.run_sample_market_maker</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.settings.html">pyokx.okx_market_maker.settings</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.strategy.BaseStrategy.html">pyokx.okx_market_maker.strategy.BaseStrategy</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.strategy.SampleMM.html">pyokx.okx_market_maker.strategy.SampleMM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.strategy.model.StrategyMeasurement.html">pyokx.okx_market_maker.strategy.model.StrategyMeasurement</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.strategy.model.StrategyOrder.html">pyokx.okx_market_maker.strategy.model.StrategyOrder</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.strategy.params.ParamsLoader.html">pyokx.okx_market_maker.strategy.params.ParamsLoader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.strategy.risk.RiskCalculator.html">pyokx.okx_market_maker.strategy.risk.RiskCalculator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.strategy.risk.RiskSnapshot.html">pyokx.okx_market_maker.strategy.risk.RiskSnapshot</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.tests.test_strategy.html">pyokx.okx_market_maker.tests.test_strategy</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.utils.InstrumentUtil.html">pyokx.okx_market_maker.utils.InstrumentUtil</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.utils.OkxEnum.html">pyokx.okx_market_maker.utils.OkxEnum</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.utils.TdModeUtil.html">pyokx.okx_market_maker.utils.TdModeUtil</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.okx_market_maker.utils.WsOrderUtil.html">pyokx.okx_market_maker.utils.WsOrderUtil</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.redis_structured_reports.html">pyokx.redis_structured_reports</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.redis_structured_streams.html">pyokx.redis_structured_streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.rest_handling.html">pyokx.rest_handling</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.rest_messages_service.html">pyokx.rest_messages_service</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.strategy_handling.html">pyokx.strategy_handling</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.AccountTest.html">pyokx.test.AccountTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.BlockTradingTest.html">pyokx.test.BlockTradingTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.BrokerTest.html">pyokx.test.BrokerTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.ConvertTest.html">pyokx.test.ConvertTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.CopyTradingTest.html">pyokx.test.CopyTradingTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.EarningTest.html">pyokx.test.EarningTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.FundingTest.html">pyokx.test.FundingTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.GridTest.html">pyokx.test.GridTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.MarketTest.html">pyokx.test.MarketTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.PublicDataTest.html">pyokx.test.PublicDataTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.SpreadTest.html">pyokx.test.SpreadTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.StackingTest.html">pyokx.test.StackingTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.SubAccountTest.html">pyokx.test.SubAccountTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.TradeTest.html">pyokx.test.TradeTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.TradingDataTest.html">pyokx.test.TradingDataTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.WsPrivateAsyncTest.html">pyokx.test.WsPrivateAsyncTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.test.WsPublicAsyncTest.html">pyokx.test.WsPublicAsyncTest</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.websocket_handling.html">pyokx.websocket_handling</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.ws_clients.WebSocketFactory.html">pyokx.ws_clients.WebSocketFactory</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.ws_clients.WsPprivateAsync.html">pyokx.ws_clients.WsPprivateAsync</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.ws_clients.WsPublicAsync.html">pyokx.ws_clients.WsPublicAsync</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.ws_clients.WsUtils.html">pyokx.ws_clients.WsUtils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pyokx.ws_data_structures.html">pyokx.ws_data_structures</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../redis_tools.config.html">redis_tools.config</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../redis_tools.consumers.html">redis_tools.consumers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../redis_tools.utils.html">redis_tools.utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rest_app.html">rest_app</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../routers.api_keys.html">routers.api_keys</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../routers.login.html">routers.login</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../routers.okx.html">routers.okx</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../routers.okx_authentication.html">routers.okx_authentication</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../routers.signup.html">routers.signup</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../shared.command_execution.html">shared.command_execution</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../shared.config.html">shared.config</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../shared.configuration_parser.html">shared.configuration_parser</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../shared.data_processing_utils.html">shared.data_processing_utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../shared.file_directory_ops.html">shared.file_directory_ops</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../shared.logging.html">shared.logging</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../shared.string_dict_utils.html">shared.string_dict_utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../shared.tmp_shared.html">shared.tmp_shared</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tradingview_tools.tradingview_widgets.html">tradingview_tools.tradingview_widgets</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../websocket_app.html">websocket_app</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../index.html">AntBot</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../index.html">Module code</a></li>
      <li class="breadcrumb-item active">pyokx.data_structures</li>
      <li class="wy-breadcrumbs-aside">
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <h1>Source code for pyokx.data_structures</h1><div class="highlight"><pre>
<span></span>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">datetime</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">List</span><span class="p">,</span> <span class="n">Optional</span><span class="p">,</span> <span class="n">Union</span>

<span class="kn">from</span> <span class="nn">pydantic</span> <span class="kn">import</span> <span class="n">BaseModel</span><span class="p">,</span> <span class="n">validator</span>

<span class="kn">from</span> <span class="nn">pyokx.okx_market_maker.utils.OkxEnum</span> <span class="kn">import</span> <span class="n">MgnMode</span><span class="p">,</span> <span class="n">PosSide</span><span class="p">,</span> <span class="n">InstType</span>


<div class="viewcode-block" id="OKXBaseModelModelMeta">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.OKXBaseModelModelMeta">[docs]</a>
<span class="k">class</span> <span class="nc">OKXBaseModelModelMeta</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">BaseModel</span><span class="p">)):</span>
    <span class="k">def</span> <span class="fm">__getattr__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">model_fields</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">item</span>
        <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__getattr__</span><span class="p">(</span><span class="n">item</span><span class="p">)</span></div>



<div class="viewcode-block" id="OKXBaseModel">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.OKXBaseModel">[docs]</a>
<span class="k">class</span> <span class="nc">OKXBaseModel</span><span class="p">(</span><span class="n">BaseModel</span><span class="p">,</span> <span class="n">metaclass</span><span class="o">=</span><span class="n">OKXBaseModelModelMeta</span><span class="p">):</span>
    <span class="k">pass</span></div>



<div class="viewcode-block" id="Order">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Order">[docs]</a>
<span class="k">class</span> <span class="nc">Order</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">accFillSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">algoClOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">algoId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">attachAlgoClOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">attachAlgoOrds</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>
    <span class="n">avgPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">cTime</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">cancelSource</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">cancelSourceReason</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">category</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ccy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">clOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fee</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">feeCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillTime</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">lever</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pnl</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">posSide</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">px</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pxType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pxUsd</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pxVol</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">quickMgnType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">rebate</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">rebateCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">reduceOnly</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">side</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">slOrdPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">slTriggerPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">slTriggerPxType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">source</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">state</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">stpId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">stpMode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tag</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tdMode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tgtCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tpOrdPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tpTriggerPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tpTriggerPxType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tradeId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">uTime</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Cancelled_Order">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Cancelled_Order">[docs]</a>
<span class="k">class</span> <span class="nc">Cancelled_Order</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">clOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sCode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sMsg</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Cancelled_Algo_Order">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Cancelled_Algo_Order">[docs]</a>
<span class="k">class</span> <span class="nc">Cancelled_Algo_Order</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;algoClOrdId&#39;: &#39;&#39;, &#39;algoId&#39;: &#39;661126556584251392&#39;, &#39;clOrdId&#39;: &#39;&#39;, &#39;sCode&#39;: &#39;0&#39;, &#39;sMsg&#39;: &#39;&#39;, &#39;tag&#39;: &#39;&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">algoClOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">algoId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">clOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sCode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sMsg</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tag</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Position">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Position">[docs]</a>
<span class="k">class</span> <span class="nc">Position</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;adl&#39;: &#39;1&#39;, &#39;availPos&#39;: &#39;&#39;, &#39;avgPx&#39;: &#39;45075.3000000000000001&#39;, &#39;baseBal&#39;: &#39;&#39;, &#39;baseBorrowed&#39;: &#39;&#39;, &#39;baseInterest&#39;: &#39;&#39;, &#39;bePx&#39;: &#39;45120.39784892446&#39;, &#39;bizRefId&#39;: &#39;&#39;, &#39;bizRefType&#39;: &#39;&#39;, &#39;cTime&#39;: &#39;1703728631744&#39;, &#39;ccy&#39;: &#39;USDT&#39;, &#39;closeOrderAlgo&#39;: [], &#39;deltaBS&#39;: &#39;&#39;, &#39;deltaPA&#39;: &#39;&#39;, &#39;fee&#39;: &#39;-0.901506&#39;, &#39;fundingFee&#39;: &#39;0&#39;, &#39;gammaBS&#39;: &#39;&#39;, &#39;gammaPA&#39;: &#39;&#39;, &#39;idxPx&#39;: &#39;43474.0&#39;, &#39;imr&#39;: &#39;&#39;, &#39;instId&#39;: &#39;BTC-USDT-240329&#39;, &#39;instType&#39;: &#39;FUTURES&#39;, &#39;interest&#39;: &#39;&#39;, &#39;last&#39;: &#39;45070.1&#39;, &#39;lever&#39;: &#39;3&#39;, &#39;liab&#39;: &#39;&#39;, &#39;liabCcy&#39;: &#39;&#39;, &#39;liqPenalty&#39;: &#39;0&#39;, &#39;liqPx&#39;: &#39;30186.137167252637&#39;, &#39;margin&#39;: &#39;601.004&#39;, &#39;markPx&#39;: &#39;45068&#39;, &#39;mgnMode&#39;: &#39;isolated&#39;, &#39;mgnRatio&#39;: &#39;74.05007741388319&#39;, &#39;mmr&#39;: &#39;7.21088&#39;, &#39;notionalUsd&#39;: &#39;1804.4145568&#39;, &#39;optVal&#39;: &#39;&#39;, &#39;pendingCloseOrdLiabVal&#39;: &#39;&#39;, &#39;pnl&#39;: &#39;0&#39;, &#39;pos&#39;: &#39;4&#39;, &#39;posCcy&#39;: &#39;&#39;, &#39;posId&#39;: &#39;660420980350771429&#39;, &#39;posSide&#39;: &#39;net&#39;, &#39;quoteBal&#39;: &#39;&#39;, &#39;quoteBorrowed&#39;: &#39;&#39;, &#39;quoteInterest&#39;: &#39;&#39;, &#39;realizedPnl&#39;: &#39;-0.901506&#39;, &#39;spotInUseAmt&#39;: &#39;&#39;, &#39;spotInUseCcy&#39;: &#39;&#39;, &#39;thetaBS&#39;: &#39;&#39;, &#39;thetaPA&#39;: &#39;&#39;, &#39;tradeId&#39;: &#39;3014208&#39;, &#39;uTime&#39;: &#39;1703728655219&#39;, &#39;upl&#39;: &#39;-0.2920000000001164&#39;, &#39;uplLastPx&#39;: &#39;-0.2080000000001746&#39;, &#39;uplRatio&#39;: &#39;-0.0004858536715233&#39;, &#39;uplRatioLastPx&#39;: &#39;-0.0003460875468385&#39;, &#39;usdPx&#39;: &#39;&#39;, &#39;vegaBS&#39;: &#39;&#39;, &#39;vegaPA&#39;: &#39;&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">adl</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">availPos</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">avgPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">baseBal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">baseBorrowed</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">baseInterest</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">bePx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">bizRefId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">bizRefType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">cTime</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ccy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">closeOrderAlgo</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">dict</span><span class="p">]</span>
    <span class="n">deltaBS</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">deltaPA</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fee</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fundingFee</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">gammaBS</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">gammaPA</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">idxPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">imr</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">interest</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">last</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">lever</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">liab</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">liabCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">liqPenalty</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">liqPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">margin</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">markPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">mgnMode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">mgnRatio</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">mmr</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">notionalUsd</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">optVal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pendingCloseOrdLiabVal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pnl</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pos</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">posCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">posId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">posSide</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">quoteBal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">quoteBorrowed</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">quoteInterest</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">realizedPnl</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">spotInUseAmt</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">spotInUseCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">thetaBS</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">thetaPA</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tradeId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">uTime</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">upl</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">uplLastPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">uplRatio</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">uplRatioLastPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">usdPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">vegaBS</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">vegaPA</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Closed_Position">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Closed_Position">[docs]</a>
<span class="k">class</span> <span class="nc">Closed_Position</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;clOrdId&#39;: &#39;&#39;, &#39;instId&#39;: &#39;BTC-USDT-240329&#39;, &#39;posSide&#39;: &#39;net&#39;, &#39;tag&#39;: &#39;&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">clOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">posSide</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tag</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Ticker">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Ticker">[docs]</a>
<span class="k">class</span> <span class="nc">Ticker</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g {&#39;instType&#39;: &#39;FUTURES&#39;, &#39;instId&#39;: &#39;BTC-USDT-240329&#39;, &#39;last&#39;: &#39;44725.3&#39;, &#39;lastSz&#39;: &#39;11&#39;, &#39;askPx&#39;: &#39;44727&#39;, &#39;askSz&#39;: &#39;147&#39;, &#39;bidPx&#39;: &#39;44724.5&#39;, &#39;bidSz&#39;: &#39;170&#39;, &#39;open24h&#39;: &#39;43854.9&#39;, &#39;high24h&#39;: &#39;45406.2&#39;, &#39;low24h&#39;: &#39;38196.8&#39;, &#39;volCcy24h&#39;: &#39;14025.4&#39;, &#39;vol24h&#39;: &#39;1402540&#39;, &#39;ts&#39;: &#39;1703741214308&#39;, &#39;sodUtc0&#39;: &#39;44977.8&#39;, &#39;sodUtc8&#39;: &#39;44452.3&#39;}]}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">instType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">last</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">lastSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">askPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">askSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">bidPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">bidSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">open24h</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">high24h</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">low24h</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">volCcy24h</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">vol24h</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ts</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sodUtc0</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sodUtc8</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Order_Placement_Return">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Order_Placement_Return">[docs]</a>
<span class="k">class</span> <span class="nc">Order_Placement_Return</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;clOrdId&#39;: &#39;&#39;, &#39;ordId&#39;: &#39;660478634888654848&#39;, &#39;sCode&#39;: &#39;0&#39;, &#39;sMsg&#39;: &#39;Order placed&#39;, &#39;tag&#39;: &#39;&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">clOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sCode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sMsg</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tag</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Algo_Order">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Algo_Order">[docs]</a>
<span class="k">class</span> <span class="nc">Algo_Order</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;activePx&#39;: &#39;&#39;, &#39;actualPx&#39;: &#39;&#39;, &#39;actualSide&#39;: &#39;&#39;, &#39;actualSz&#39;: &#39;0&#39;, &#39;algoClOrdId&#39;: &#39;&#39;, &#39;algoId&#39;: &#39;660707839958183936&#39;, &#39;amendPxOnTriggerType&#39;: &#39;0&#39;, &#39;attachAlgoOrds&#39;: [], &#39;cTime&#39;: &#39;1703797024404&#39;, &#39;callbackRatio&#39;: &#39;&#39;, &#39;callbackSpread&#39;: &#39;&#39;, &#39;ccy&#39;: &#39;&#39;, &#39;clOrdId&#39;: &#39;&#39;, &#39;closeFraction&#39;: &#39;&#39;, &#39;failCode&#39;: &#39;&#39;, &#39;instId&#39;: &#39;BTC-USDT-240329&#39;, &#39;instType&#39;: &#39;FUTURES&#39;, &#39;last&#39;: &#39;44080&#39;, &#39;lever&#39;: &#39;3&#39;, &#39;moveTriggerPx&#39;: &#39;&#39;, &#39;ordId&#39;: &#39;&#39;, &#39;ordIdList&#39;: [], &#39;ordPx&#39;: &#39;&#39;, &#39;ordType&#39;: &#39;conditional&#39;, &#39;posSide&#39;: &#39;net&#39;, &#39;pxLimit&#39;: &#39;&#39;, &#39;pxSpread&#39;: &#39;&#39;, &#39;pxVar&#39;: &#39;&#39;, &#39;quickMgnType&#39;: &#39;&#39;, &#39;reduceOnly&#39;: &#39;false&#39;, &#39;side&#39;: &#39;buy&#39;, &#39;slOrdPx&#39;: &#39;&#39;, &#39;slTriggerPx&#39;: &#39;&#39;, &#39;slTriggerPxType&#39;: &#39;&#39;, &#39;state&#39;: &#39;live&#39;, &#39;sz&#39;: &#39;1&#39;, &#39;szLimit&#39;: &#39;&#39;, &#39;tag&#39;: &#39;&#39;, &#39;tdMode&#39;: &#39;isolated&#39;, &#39;tgtCcy&#39;: &#39;&#39;, &#39;timeInterval&#39;: &#39;&#39;, &#39;tpOrdPx&#39;: &#39;-1&#39;, &#39;tpTriggerPx&#39;: &#39;44075&#39;, &#39;tpTriggerPxType&#39;: &#39;last&#39;, &#39;triggerPx&#39;: &#39;&#39;, &#39;triggerPxType&#39;: &#39;&#39;, &#39;triggerTime&#39;: &#39;&#39;}, {&#39;activePx&#39;: &#39;&#39;, &#39;actualPx&#39;: &#39;&#39;, &#39;actualSide&#39;: &#39;&#39;, &#39;actualSz&#39;: &#39;0&#39;, &#39;algoClOrdId&#39;: &#39;&#39;, &#39;algoId&#39;: &#39;660707810421895170&#39;, &#39;amendPxOnTriggerType&#39;: &#39;0&#39;, &#39;attachAlgoOrds&#39;: [], &#39;cTime&#39;: &#39;1703797017362&#39;, &#39;callbackRatio&#39;: &#39;&#39;, &#39;callbackSpread&#39;: &#39;&#39;, &#39;ccy&#39;: &#39;&#39;, &#39;clOrdId&#39;: &#39;&#39;, &#39;closeFraction&#39;: &#39;&#39;, &#39;failCode&#39;: &#39;&#39;, &#39;instId&#39;: &#39;BTC-USDT-240329&#39;, &#39;instType&#39;: &#39;FUTURES&#39;, &#39;last&#39;: &#39;44079.5&#39;, &#39;lever&#39;: &#39;3&#39;, &#39;moveTriggerPx&#39;: &#39;&#39;, &#39;ordId&#39;: &#39;&#39;, &#39;ordIdList&#39;: [], &#39;ordPx&#39;: &#39;&#39;, &#39;ordType&#39;: &#39;conditional&#39;, &#39;posSide&#39;: &#39;net&#39;, &#39;pxLimit&#39;: &#39;&#39;, &#39;pxSpread&#39;: &#39;&#39;, &#39;pxVar&#39;: &#39;&#39;, &#39;quickMgnType&#39;: &#39;&#39;, &#39;reduceOnly&#39;: &#39;false&#39;, &#39;side&#39;: &#39;buy&#39;, &#39;slOrdPx&#39;: &#39;&#39;, &#39;slTriggerPx&#39;: &#39;&#39;, &#39;slTriggerPxType&#39;: &#39;&#39;, &#39;state&#39;: &#39;live&#39;, &#39;sz&#39;: &#39;1&#39;, &#39;szLimit&#39;: &#39;&#39;, &#39;tag&#39;: &#39;&#39;, &#39;tdMode&#39;: &#39;isolated&#39;, &#39;tgtCcy&#39;: &#39;&#39;, &#39;timeInterval&#39;: &#39;&#39;, &#39;tpOrdPx&#39;: &#39;-1&#39;, &#39;tpTriggerPx&#39;: &#39;44074.5&#39;, &#39;tpTriggerPxType&#39;: &#39;last&#39;, &#39;triggerPx&#39;: &#39;&#39;, &#39;triggerPxType&#39;: &#39;&#39;, &#39;triggerTime&#39;: &#39;&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">activePx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">actualPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">actualSide</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">actualSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">algoClOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">algoId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">amendPxOnTriggerType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">attachAlgoOrds</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>
    <span class="n">cTime</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">callbackRatio</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">callbackSpread</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ccy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">clOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">closeFraction</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">failCode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">last</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">lever</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">moveTriggerPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordIdList</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>
    <span class="n">ordPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">posSide</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pxLimit</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pxSpread</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">pxVar</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">quickMgnType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">reduceOnly</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">side</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">slOrdPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">slTriggerPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">slTriggerPxType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">state</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">szLimit</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tag</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tdMode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tgtCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">timeInterval</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tpOrdPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tpTriggerPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tpTriggerPxType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">triggerPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">triggerPxType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">triggerTime</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Algo_Order_Placement_Return">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Algo_Order_Placement_Return">[docs]</a>
<span class="k">class</span> <span class="nc">Algo_Order_Placement_Return</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;algoClOrdId&#39;: &#39;&#39;, &#39;algoId&#39;: &#39;660710963351515145&#39;, &#39;clOrdId&#39;: &#39;&#39;, &#39;sCode&#39;: &#39;0&#39;, &#39;sMsg&#39;: &#39;&#39;, &#39;tag&#39;: &#39;&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">algoClOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">algoId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">clOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sCode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">sMsg</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tag</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Instrument">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Instrument">[docs]</a>
<span class="k">class</span> <span class="nc">Instrument</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;alias&#39;: &#39;next_month&#39;, &#39;baseCcy&#39;: &#39;&#39;, &#39;category&#39;: &#39;1&#39;, &#39;ctMult&#39;: &#39;1&#39;, &#39;ctType&#39;: &#39;inverse&#39;, &#39;ctVal&#39;: &#39;100&#39;,</span>
<span class="sd">         &#39;ctValCcy&#39;: &#39;USD&#39;, &#39;expTime&#39;: &#39;1708675200000&#39;, &#39;instFamily&#39;: &#39;BTC-USD&#39;, &#39;instId&#39;: &#39;BTC-USD-240223&#39;,</span>
<span class="sd">         &#39;instType&#39;: &#39;FUTURES&#39;, &#39;lever&#39;: &#39;100&#39;, &#39;listTime&#39;: &#39;1702627800062&#39;, &#39;lotSz&#39;: &#39;1&#39;,</span>
<span class="sd">         &#39;maxIcebergSz&#39;: &#39;1000000.0000000000000000&#39;, &#39;maxLmtAmt&#39;: &#39;1000000&#39;, &#39;maxLmtSz&#39;: &#39;1000000&#39;, &#39;maxMktAmt&#39;: &#39;&#39;,</span>
<span class="sd">         &#39;maxMktSz&#39;: &#39;10000&#39;, &#39;maxStopSz&#39;: &#39;10000&#39;, &#39;maxTriggerSz&#39;: &#39;1000000.0000000000000000&#39;,</span>
<span class="sd">         &#39;maxTwapSz&#39;: &#39;1000000.0000000000000000&#39;, &#39;minSz&#39;: &#39;1&#39;, &#39;optType&#39;: &#39;&#39;, &#39;quoteCcy&#39;: &#39;&#39;, &#39;settleCcy&#39;: &#39;BTC&#39;,</span>
<span class="sd">         &#39;state&#39;: &#39;live&#39;, &#39;stk&#39;: &#39;&#39;, &#39;tickSz&#39;: &#39;0.01&#39;, &#39;uly&#39;: &#39;BTC-USD&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">alias</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">baseCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">category</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ctMult</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ctType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ctVal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ctValCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">expTime</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instFamily</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">lever</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">listTime</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">lotSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxIcebergSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxLmtAmt</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxLmtSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxMktAmt</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxMktSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxStopSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxTriggerSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxTwapSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">minSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">optType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">quoteCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">settleCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">state</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">stk</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">tickSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">uly</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Bid">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Bid">[docs]</a>
<span class="k">class</span> <span class="nc">Bid</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. &#39;43752.4&#39;, &#39;156&#39;, &#39;0&#39;, &#39;1&#39;</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">price</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">quantity</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">deprecated_value</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">number_of_orders</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Ask">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Ask">[docs]</a>
<span class="k">class</span> <span class="nc">Ask</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. &#39;43752.4&#39;, &#39;156&#39;, &#39;0&#39;, &#39;1&#39;</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">price</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">quantity</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">deprecated_value</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">number_of_orders</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Orderbook_Snapshot">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Orderbook_Snapshot">[docs]</a>
<span class="k">class</span> <span class="nc">Orderbook_Snapshot</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;asks&#39;: [[&#39;43746.5&#39;, &#39;106&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43751.1&#39;, &#39;171&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43751.2&#39;, &#39;118&#39;, &#39;0&#39;, &#39;1&#39;],</span>
<span class="sd">          [&#39;43752.4&#39;, &#39;156&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43753.5&#39;, &#39;151&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43753.7&#39;, &#39;126&#39;, &#39;0&#39;, &#39;1&#39;],</span>
<span class="sd">          [&#39;43754.7&#39;, &#39;121&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43754.8&#39;, &#39;158&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43755.4&#39;, &#39;307&#39;, &#39;0&#39;, &#39;2&#39;],</span>
<span class="sd">          [&#39;43755.7&#39;, &#39;179&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43756.4&#39;, &#39;134&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43757&#39;, &#39;179&#39;, &#39;0&#39;, &#39;1&#39;],</span>
<span class="sd">          [&#39;43757.2&#39;, &#39;154&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43757.3&#39;, &#39;171&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43758.1&#39;, &#39;165&#39;, &#39;0&#39;, &#39;1&#39;],</span>
<span class="sd">          [&#39;43759.1&#39;, &#39;159&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43759.2&#39;, &#39;128&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43759.4&#39;, &#39;125&#39;, &#39;0&#39;, &#39;1&#39;],</span>
<span class="sd">          [&#39;43760.3&#39;, &#39;169&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43922.5&#39;, &#39;1&#39;, &#39;0&#39;, &#39;1&#39;]],</span>
<span class="sd"> &#39;bids&#39;: [[&#39;43746.4&#39;, &#39;136&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43746.3&#39;, &#39;151&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43740.7&#39;, &#39;153&#39;, &#39;0&#39;, &#39;1&#39;],</span>
<span class="sd">          [&#39;43739.6&#39;, &#39;163&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43739.3&#39;, &#39;143&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43737.9&#39;, &#39;133&#39;, &#39;0&#39;, &#39;1&#39;],</span>
<span class="sd">          [&#39;43736.8&#39;, &#39;163&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43735.1&#39;, &#39;168&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43735&#39;, &#39;165&#39;, &#39;0&#39;, &#39;1&#39;],</span>
<span class="sd">          [&#39;43734.9&#39;, &#39;168&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43733.8&#39;, &#39;171&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43733.1&#39;, &#39;296&#39;, &#39;0&#39;, &#39;2&#39;],</span>
<span class="sd">          [&#39;43732.7&#39;, &#39;131&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43732.6&#39;, &#39;127&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43731.6&#39;, &#39;314&#39;, &#39;0&#39;, &#39;2&#39;],</span>
<span class="sd">          [&#39;43729&#39;, &#39;298&#39;, &#39;0&#39;, &#39;2&#39;], [&#39;43728.8&#39;, &#39;180&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43514&#39;, &#39;1&#39;, &#39;0&#39;, &#39;1&#39;],</span>
<span class="sd">          [&#39;43311.2&#39;, &#39;1&#39;, &#39;0&#39;, &#39;1&#39;], [&#39;43109.3&#39;, &#39;1&#39;, &#39;0&#39;, &#39;1&#39;]], &#39;ts&#39;: &#39;1703914467407&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">depth</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">asks</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Ask</span><span class="p">]</span>
    <span class="n">bids</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Bid</span><span class="p">]</span>
    <span class="n">ts</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="Simplified_Balance_Details">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.Simplified_Balance_Details">[docs]</a>
<span class="k">class</span> <span class="nc">Simplified_Balance_Details</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">Currency</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">Available_Balance</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">Equity</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">Equity_in_USD</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">Frozen_Balance</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="AccountBalanceDetails">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.AccountBalanceDetails">[docs]</a>
<span class="k">class</span> <span class="nc">AccountBalanceDetails</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;availBal&#39;: &#39;1&#39;, &#39;availEq&#39;: &#39;1&#39;, &#39;borrowFroz&#39;: &#39;&#39;, &#39;cashBal&#39;: &#39;1&#39;, &#39;ccy&#39;: &#39;BTC&#39;, &#39;crossLiab&#39;: &#39;&#39;, &#39;disEq&#39;: &#39;42219&#39;,</span>
<span class="sd">          &#39;eq&#39;: &#39;1&#39;, &#39;eqUsd&#39;: &#39;42219&#39;, &#39;fixedBal&#39;: &#39;0&#39;, &#39;frozenBal&#39;: &#39;0&#39;, &#39;interest&#39;: &#39;&#39;, &#39;isoEq&#39;: &#39;0&#39;, &#39;isoLiab&#39;: &#39;&#39;,</span>
<span class="sd">          &#39;isoUpl&#39;: &#39;0&#39;, &#39;liab&#39;: &#39;&#39;, &#39;maxLoan&#39;: &#39;&#39;, &#39;mgnRatio&#39;: &#39;&#39;, &#39;notionalLever&#39;: &#39;0&#39;, &#39;ordFrozen&#39;: &#39;0&#39;, &#39;spotInUseAmt&#39;: &#39;&#39;,</span>
<span class="sd">          &#39;spotIsoBal&#39;: &#39;0&#39;, &#39;stgyEq&#39;: &#39;0&#39;, &#39;twap&#39;: &#39;0&#39;, &#39;uTime&#39;: &#39;1703639691142&#39;, &#39;upl&#39;: &#39;0&#39;, &#39;uplLiab&#39;: &#39;&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">availBal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">availEq</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">borrowFroz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">cashBal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ccy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">crossLiab</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">disEq</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">eq</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">eqUsd</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fixedBal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">frozenBal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">interest</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">isoEq</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">isoLiab</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">isoUpl</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">liab</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxLoan</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">mgnRatio</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">notionalLever</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordFrozen</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">spotInUseAmt</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">spotIsoBal</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">stgyEq</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">twap</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">uTime</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">upl</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">uplLiab</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="AccountBalanceData">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.AccountBalanceData">[docs]</a>
<span class="k">class</span> <span class="nc">AccountBalanceData</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
<span class="w">    </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    e.g. {&#39;adjEq&#39;: &#39;&#39;, &#39;borrowFroz&#39;: &#39;&#39;, &#39;details&#39;: [{&#39;availBal&#39;: &#39;1&#39;, &#39;availEq&#39;: &#39;1&#39;, &#39;borrowFroz&#39;: &#39;&#39;, &#39;cashBal&#39;: &#39;1&#39;, &#39;ccy&#39;: &#39;BTC&#39;, &#39;crossLiab&#39;: &#39;&#39;, &#39;disEq&#39;: &#39;42219&#39;, &#39;eq&#39;: &#39;1&#39;, &#39;eqUsd&#39;: &#39;42219&#39;, &#39;fixedBal&#39;: &#39;0&#39;, &#39;frozenBal&#39;: &#39;0&#39;, &#39;interest&#39;: &#39;&#39;, &#39;isoEq&#39;: &#39;0&#39;, &#39;isoLiab&#39;: &#39;&#39;, &#39;isoUpl&#39;: &#39;0&#39;, &#39;liab&#39;: &#39;&#39;, &#39;maxLoan&#39;: &#39;&#39;, &#39;mgnRatio&#39;: &#39;&#39;, &#39;notionalLever&#39;: &#39;0&#39;, &#39;ordFrozen&#39;: &#39;0&#39;, &#39;spotInUseAmt&#39;: &#39;&#39;, &#39;spotIsoBal&#39;: &#39;0&#39;, &#39;stgyEq&#39;: &#39;0&#39;, &#39;twap&#39;: &#39;0&#39;, &#39;uTime&#39;: &#39;1703639691142&#39;, &#39;upl&#39;: &#39;0&#39;, &#39;uplLiab&#39;: &#39;&#39;}, {&#39;availBal&#39;: &#39;100&#39;, &#39;availEq&#39;: &#39;100&#39;, &#39;borrowFroz&#39;: &#39;&#39;, &#39;cashBal&#39;: &#39;100&#39;, &#39;ccy&#39;: &#39;OKB&#39;, &#39;crossLiab&#39;: &#39;&#39;, &#39;disEq&#39;: &#39;5207.329999999999&#39;, &#39;eq&#39;: &#39;100&#39;, &#39;eqUsd&#39;: &#39;5481.4&#39;, &#39;fixedBal&#39;: &#39;0&#39;, &#39;frozenBal&#39;: &#39;0&#39;, &#39;interest&#39;: &#39;&#39;, &#39;isoEq&#39;: &#39;0&#39;, &#39;isoLiab&#39;: &#39;&#39;, &#39;isoUpl&#39;: &#39;0&#39;, &#39;liab&#39;: &#39;&#39;, &#39;maxLoan&#39;: &#39;&#39;, &#39;mgnRatio&#39;: &#39;&#39;, &#39;notionalLever&#39;: &#39;0&#39;, &#39;ordFrozen&#39;: &#39;0&#39;, &#39;spotInUseAmt&#39;: &#39;&#39;, &#39;spotIsoBal&#39;: &#39;0&#39;, &#39;stgyEq&#39;: &#39;0&#39;, &#39;twap&#39;: &#39;0&#39;, &#39;uTime&#39;: &#39;1703639691152&#39;, &#39;upl&#39;: &#39;0&#39;, &#39;uplLiab&#39;: &#39;&#39;}, {&#39;availBal&#39;: &#39;5069.205129833334&#39;, &#39;availEq&#39;: &#39;5069.205129833334&#39;, &#39;borrowFroz&#39;: &#39;&#39;, &#39;cashBal&#39;: &#39;5069.205129833334&#39;, &#39;ccy&#39;: &#39;USDT&#39;, &#39;crossLiab&#39;: &#39;&#39;, &#39;disEq&#39;: &#39;5218.680085966916&#39;, &#39;eq&#39;: &#39;5217.0627965&#39;, &#39;eqUsd&#39;: &#39;5218.680085966916&#39;, &#39;fixedBal&#39;: &#39;0&#39;, &#39;frozenBal&#39;: &#39;147.85766666666666&#39;, &#39;interest&#39;: &#39;&#39;, &#39;isoEq&#39;: &#39;147.85766666666666&#39;, &#39;isoLiab&#39;: &#39;&#39;, &#39;isoUpl&#39;: &#39;2.5&#39;, &#39;liab&#39;: &#39;&#39;, &#39;maxLoan&#39;: &#39;&#39;, &#39;mgnRatio&#39;: &#39;&#39;, &#39;notionalLever&#39;: &#39;0&#39;, &#39;ordFrozen&#39;: &#39;0&#39;, &#39;spotInUseAmt&#39;: &#39;&#39;, &#39;spotIsoBal&#39;: &#39;0&#39;, &#39;stgyEq&#39;: &#39;0&#39;, &#39;twap&#39;: &#39;0&#39;, &#39;uTime&#39;: &#39;1703877105585&#39;, &#39;upl&#39;: &#39;2.5&#39;, &#39;uplLiab&#39;: &#39;&#39;}, {&#39;availBal&#39;: &#39;1&#39;, &#39;availEq&#39;: &#39;1&#39;, &#39;borrowFroz&#39;: &#39;&#39;, &#39;cashBal&#39;: &#39;1&#39;, &#39;ccy&#39;: &#39;ETH&#39;, &#39;crossLiab&#39;: &#39;&#39;, &#39;disEq&#39;: &#39;2310.18&#39;, &#39;eq&#39;: &#39;1&#39;, &#39;eqUsd&#39;: &#39;2310.18&#39;, &#39;fixedBal&#39;: &#39;0&#39;, &#39;frozenBal&#39;: &#39;0&#39;, &#39;interest&#39;: &#39;&#39;, &#39;isoEq&#39;: &#39;0&#39;, &#39;isoLiab&#39;: &#39;&#39;, &#39;isoUpl&#39;: &#39;0&#39;, &#39;liab&#39;: &#39;&#39;, &#39;maxLoan&#39;: &#39;&#39;, &#39;mgnRatio&#39;: &#39;&#39;, &#39;notionalLever&#39;: &#39;0&#39;, &#39;ordFrozen&#39;: &#39;0&#39;, &#39;spotInUseAmt&#39;: &#39;&#39;, &#39;spotIsoBal&#39;: &#39;0&#39;, &#39;stgyEq&#39;: &#39;0&#39;, &#39;twap&#39;: &#39;0&#39;, &#39;uTime&#39;: &#39;1703639691162&#39;, &#39;upl&#39;: &#39;0&#39;, &#39;uplLiab&#39;: &#39;&#39;}], &#39;imr&#39;: &#39;&#39;, &#39;isoEq&#39;: &#39;147.90350254333333&#39;, &#39;mgnRatio&#39;: &#39;&#39;, &#39;mmr&#39;: &#39;&#39;, &#39;notionalUsd&#39;: &#39;&#39;, &#39;ordFroz&#39;: &#39;&#39;, &#39;totalEq&#39;: &#39;55229.26008596692&#39;, &#39;uTime&#39;: &#39;1703884466962&#39;}</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">adjEq</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">borrowFroz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">details</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">AccountBalanceDetails</span><span class="p">]</span>
    <span class="n">imr</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">isoEq</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">mgnRatio</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">mmr</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">notionalUsd</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordFroz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">totalEq</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">uTime</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="PositionHistory">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.PositionHistory">[docs]</a>
<span class="k">class</span> <span class="nc">PositionHistory</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">instType</span><span class="p">:</span> <span class="n">InstType</span>  <span class="c1"># Instrument type</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>  <span class="c1"># Instrument ID</span>
    <span class="n">mgnMode</span><span class="p">:</span> <span class="n">MgnMode</span>  <span class="c1"># Margin mode</span>
    <span class="nb">type</span><span class="p">:</span> <span class="nb">int</span>  <span class="c1"># The type of latest close position, mapping to OrderCategory for similar behavior</span>
    <span class="n">cTime</span><span class="p">:</span> <span class="nb">int</span>  <span class="c1"># Created time of position</span>
    <span class="n">uTime</span><span class="p">:</span> <span class="nb">int</span>  <span class="c1"># Updated time of position</span>
    <span class="n">openAvgPx</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Average price of opening position</span>
    <span class="n">closeAvgPx</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Average price of closing position</span>
    <span class="n">posId</span><span class="p">:</span> <span class="nb">str</span>  <span class="c1"># Position ID</span>
    <span class="n">openMaxPos</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Max quantity of position</span>
    <span class="n">closeTotalPos</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Position&#39;s cumulative closed volume</span>
    <span class="n">realizedPnl</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Realized profit and loss</span>
    <span class="n">fee</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Accumulated fee. Negative represents charge, positive represents rebate.</span>
    <span class="n">fundingFee</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Accumulated funding fee</span>
    <span class="n">liqPenalty</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Accumulated liquidation penalty, negative when there is a value.</span>
    <span class="n">pnl</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Profit and loss</span>
    <span class="n">pnlRatio</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># P&amp;L ratio</span>
    <span class="n">lever</span><span class="p">:</span> <span class="nb">float</span>  <span class="c1"># Leverage</span>
    <span class="n">direction</span><span class="p">:</span> <span class="n">PosSide</span>  <span class="c1"># Direction: long, short</span>
    <span class="n">triggerPx</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>  <span class="c1"># Trigger mark price, value when type is 3, 4, or 5; None when type is 1 or 2</span>
    <span class="n">uly</span><span class="p">:</span> <span class="nb">str</span>  <span class="c1"># Underlying</span>
    <span class="n">ccy</span><span class="p">:</span> <span class="nb">str</span>  <span class="c1"># Currency used for margin</span>

<div class="viewcode-block" id="PositionHistory.handle_triggerPx">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.PositionHistory.handle_triggerPx">[docs]</a>
    <span class="nd">@validator</span><span class="p">(</span><span class="s1">&#39;triggerPx&#39;</span><span class="p">,</span> <span class="n">pre</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
    <span class="k">def</span> <span class="nf">handle_triggerPx</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">value</span> <span class="o">==</span> <span class="s1">&#39;&#39;</span><span class="p">:</span>
            <span class="k">return</span> <span class="kc">None</span>  <span class="c1"># Convert empty string to None</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>  <span class="c1"># Try to convert to float</span>
        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;triggerPx should be a float or empty string, got </span><span class="si">{</span><span class="n">value</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span></div>


<div class="viewcode-block" id="PositionHistory.Config">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.PositionHistory.Config">[docs]</a>
    <span class="k">class</span> <span class="nc">Config</span><span class="p">:</span>
        <span class="n">use_enum_values</span> <span class="o">=</span> <span class="kc">True</span></div>
</div>



<div class="viewcode-block" id="FillEntry">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.FillEntry">[docs]</a>
<span class="k">class</span> <span class="nc">FillEntry</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">side</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillSz</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillPx</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillPxVol</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
    <span class="n">fillFwdPx</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
    <span class="n">fee</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillPnl</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ordId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillPxUsd</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">clOrdId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">posSide</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">billId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillMarkVol</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
    <span class="n">tag</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
    <span class="n">fillTime</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">execType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillIdxPx</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
    <span class="n">tradeId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">fillMarkPx</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
    <span class="n">feeCcy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ts</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="AccountConfigData">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.AccountConfigData">[docs]</a>
<span class="k">class</span> <span class="nc">AccountConfigData</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">acctLv</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">autoLoan</span><span class="p">:</span> <span class="nb">bool</span>
    <span class="n">ctIsoMode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">greeksType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">ip</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">kycLv</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">label</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">level</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">levelTmp</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">liquidationGear</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">mainUid</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">mgnIsoMode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">opAuth</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">perm</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">posMode</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">roleType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">spotOffsetType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">spotRoleType</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">spotTraderInsts</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>
    <span class="n">traderInsts</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>
    <span class="n">uid</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="MaxOrderSizeData">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.MaxOrderSizeData">[docs]</a>
<span class="k">class</span> <span class="nc">MaxOrderSizeData</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">ccy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxBuy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">maxSell</span><span class="p">:</span> <span class="nb">str</span></div>



<div class="viewcode-block" id="MaxAvailSizeData">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.MaxAvailSizeData">[docs]</a>
<span class="k">class</span> <span class="nc">MaxAvailSizeData</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">availBuy</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">availSell</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span></div>



<span class="c1">#</span>
<div class="viewcode-block" id="InstrumentStatusReport">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.InstrumentStatusReport">[docs]</a>
<span class="k">class</span> <span class="nc">InstrumentStatusReport</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">timestamp</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">utcnow</span><span class="p">()</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">&quot;%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S&quot;</span><span class="p">)</span>
    <span class="n">instId</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">max_order_size</span><span class="p">:</span> <span class="n">MaxOrderSizeData</span>
    <span class="n">max_avail_size</span><span class="p">:</span> <span class="n">MaxAvailSizeData</span>
    <span class="n">positions</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Position</span><span class="p">]</span>
    <span class="n">orders</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Order</span><span class="p">]</span>
    <span class="n">algo_orders</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Algo_Order</span><span class="p">]</span></div>



<div class="viewcode-block" id="AccountStatusReport">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.AccountStatusReport">[docs]</a>
<span class="k">class</span> <span class="nc">AccountStatusReport</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">timestamp</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">utcnow</span><span class="p">()</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">&quot;%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S&quot;</span><span class="p">)</span>
    <span class="n">account_balance</span><span class="p">:</span> <span class="n">AccountBalanceData</span>
    <span class="n">account_config</span><span class="p">:</span> <span class="n">AccountConfigData</span>
    <span class="n">all_positions</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Position</span><span class="p">]</span>
    <span class="n">all_orders</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Order</span><span class="p">]</span>
    <span class="n">all_algo_orders</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Algo_Order</span><span class="p">]</span>
    <span class="n">simplified_balance</span><span class="p">:</span> <span class="n">Simplified_Balance_Details</span></div>



<div class="viewcode-block" id="DCAInputParameters">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.DCAInputParameters">[docs]</a>
<span class="k">class</span> <span class="nc">DCAInputParameters</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">usd_amount</span><span class="p">:</span> <span class="nb">float</span>
    <span class="n">trigger_price_offset</span><span class="p">:</span> <span class="nb">float</span>
    <span class="n">order_type</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">order_side</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">execution_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">tp_trigger_price_type</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
    <span class="n">tp_trigger_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">tp_execution_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">sl_trigger_price_type</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
    <span class="n">sl_trigger_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">sl_execution_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span></div>



<div class="viewcode-block" id="DCAOrderParameters">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.DCAOrderParameters">[docs]</a>
<span class="k">class</span> <span class="nc">DCAOrderParameters</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">size</span><span class="p">:</span> <span class="nb">float</span>
    <span class="n">trigger_price</span><span class="p">:</span> <span class="nb">float</span>
    <span class="nb">type</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">side</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">execution_price</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span>
    <span class="n">tp_trigger_price_type</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
    <span class="n">tp_trigger_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">tp_execution_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">sl_trigger_price_type</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
    <span class="n">sl_trigger_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">sl_execution_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span></div>


<div class="viewcode-block" id="OKXSignalInput">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.OKXSignalInput">[docs]</a>
<span class="k">class</span> <span class="nc">OKXSignalInput</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">instID</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
    <span class="n">usd_order_size</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">leverage</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">order_side</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
    <span class="n">order_type</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
    <span class="n">max_orderbook_limit_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">flip_position_if_opposite_side</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
    <span class="n">clear_prior_to_new_order</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
    <span class="n">red_button</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
    <span class="n">tp_trigger_price_type</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
    <span class="n">tp_trigger_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">tp_execution_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">sl_trigger_price_type</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>
    <span class="n">sl_trigger_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">sl_execution_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">trailing_stop_activation_price_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">trailing_stop_callback_offset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
    <span class="n">dca_parameters</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="n">DCAInputParameters</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span></div>



<div class="viewcode-block" id="PremiumIndicatorSignals">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.PremiumIndicatorSignals">[docs]</a>
<span class="k">class</span> <span class="nc">PremiumIndicatorSignals</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">Bullish</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span>
    <span class="n">Bearish</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span>
    <span class="n">Bullish_plus</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span>
    <span class="n">Bearish_plus</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span>
    <span class="n">Bullish_Exit</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span>
    <span class="n">Bearish_Exit</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span>

<div class="viewcode-block" id="PremiumIndicatorSignals.tradingview_json_payload">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.PremiumIndicatorSignals.tradingview_json_payload">[docs]</a>
    <span class="k">def</span> <span class="nf">tradingview_json_payload</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="s2">&quot;&quot;&quot;{</span>
<span class="s2">        &quot;Bullish&quot;: {{plot(&quot;Bullish&quot;)}},</span>
<span class="s2">        &quot;Bearish&quot;: {{plot(&quot;Bearish&quot;)}},</span>
<span class="s2">        &quot;Bullish_plus&quot;: {{plot(&quot;Bullish+&quot;)}},</span>
<span class="s2">        &quot;Bearish_plus&quot;: {{plot(&quot;Bearish+&quot;)}},</span>
<span class="s2">        &quot;Bullish_Exit&quot;: {{plot(&quot;Bullish Exit&quot;)}},</span>
<span class="s2">        &quot;Bearish_Exit&quot;: {{plot(&quot;Bearish Exit&quot;)}}</span>
<span class="s2">    }&quot;&quot;&quot;</span></div>
</div>





<div class="viewcode-block" id="OKXPremiumIndicatorSignalRequestForm">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.OKXPremiumIndicatorSignalRequestForm">[docs]</a>
<span class="k">class</span> <span class="nc">OKXPremiumIndicatorSignalRequestForm</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">InstIdAPIKey</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">OKXSignalInput</span><span class="p">:</span> <span class="n">OKXSignalInput</span>
    <span class="n">PremiumIndicatorSignals</span><span class="p">:</span> <span class="n">PremiumIndicatorSignals</span>

<div class="viewcode-block" id="OKXPremiumIndicatorSignalRequestForm.to_tradingview_json_payload">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.OKXPremiumIndicatorSignalRequestForm.to_tradingview_json_payload">[docs]</a>
    <span class="k">def</span> <span class="nf">to_tradingview_json_payload</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="c1"># return f&quot;&quot;&quot;{</span>
        <span class="c1">#     &quot;InstIdAPIKey&quot;: {self.InstIdAPIKey},</span>
        <span class="c1">#     &quot;OKXSignalInput&quot;: {self.OKXSignalInput.model_dump()},</span>
        <span class="c1">#     &quot;PremiumIndicatorSignals&quot;: {self.PremiumIndicatorSignals.tradingview_json_payload()}</span>
        <span class="c1"># }&quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;&quot;&quot;</span><span class="se">{{</span>
<span class="s2">            &quot;InstIdAPIKey&quot;: &quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">InstIdAPIKey</span><span class="si">}</span><span class="s2">&quot;,</span>
<span class="s2">            &quot;OKXSignalInput&quot;: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">OKXSignalInput</span><span class="o">.</span><span class="n">model_dump</span><span class="p">()</span><span class="si">}</span><span class="s2">,</span>
<span class="s2">            &quot;PremiumIndicatorSignals&quot;: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">PremiumIndicatorSignals</span><span class="o">.</span><span class="n">tradingview_json_payload</span><span class="p">()</span><span class="si">}</span>
<span class="s2">        </span><span class="se">}}</span><span class="s2">&quot;&quot;&quot;</span></div>
</div>





<div class="viewcode-block" id="InstIdSignalRequestForm">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.InstIdSignalRequestForm">[docs]</a>
<span class="k">class</span> <span class="nc">InstIdSignalRequestForm</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">InstIdAPIKey</span><span class="p">:</span> <span class="nb">str</span>
    <span class="n">OKXSignalInput</span><span class="p">:</span> <span class="n">OKXSignalInput</span></div>



<div class="viewcode-block" id="FillHistoricalMetricsEntry">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.FillHistoricalMetricsEntry">[docs]</a>
<span class="k">class</span> <span class="nc">FillHistoricalMetricsEntry</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">avg_fill_pnl</span><span class="p">:</span> <span class="nb">float</span>
    <span class="n">total_fill_pnl</span><span class="p">:</span> <span class="nb">float</span>
    <span class="n">total_fill_fee</span><span class="p">:</span> <span class="nb">float</span></div>



<div class="viewcode-block" id="FillHistoricalMetrics">
<a class="viewcode-back" href="../../pyokx.data_structures.html#pyokx.data_structures.FillHistoricalMetrics">[docs]</a>
<span class="k">class</span> <span class="nc">FillHistoricalMetrics</span><span class="p">(</span><span class="n">OKXBaseModel</span><span class="p">):</span>
    <span class="n">ONE_DAY</span><span class="p">:</span> <span class="n">FillHistoricalMetricsEntry</span>
    <span class="n">ONE_WEEK</span><span class="p">:</span> <span class="n">FillHistoricalMetricsEntry</span>
    <span class="n">ONE_MONTH</span><span class="p">:</span> <span class="n">FillHistoricalMetricsEntry</span>
    <span class="n">THREE_MONTHS</span><span class="p">:</span> <span class="n">FillHistoricalMetricsEntry</span></div>

</pre></div>

           </div>
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2024, Ruben Fernandez Carbon.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>